<template>
	<u-tabbar activeColor="#252525" :value="tabVal" :border="false" fixed>
		<u-tabbar-item v-for="item in tabBarList" :key="item.text" :name="item.url" :text="item.text"
			:icon="tabVal===item.url?item.actIcon:item.icon" @click="tabclick(item)"></u-tabbar-item>
	</u-tabbar>
</template>

<script>
	import {mapActions} from "vuex";
	export default {
		props: {
			path:{
				type:String,
				default:''
			},
			tabBarList: {
				type: Array,
				default: () => uni.getStorageSync('tabBarList') || []
			}
		},
		data() {
			return {
				tabs: [],
				tabVal: ''
			}
		},
		created() {
			this.tabVal = this.path
			console.log(this.path);
		},

		methods: {
      ...mapActions([
          "pageUpdateNotice"
      ]),
			tabclick(item) {
        if (!item.text) {
          this.pageUpdateNotice()
        }
        uni.switchTab({
          url: item.url,
          fail(e) {
            console.log(e);
          }
        })
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>